{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<div align=\"right\">Peter Norvig</div>\n",
    "\n",
    "# WWW: Who Will Win?\n",
    "\n",
    "This is a notebook for reasoning about who will win playoff series in basketball (and could be used for other sports). The table of contents for this notebook:\n",
    "\n",
    "* [Model Discussion](#Models:-Introduction-and-Discussion) What model should I use to make predictions?\n",
    "* [2019 NBA Playoffs](#2019-NBA-Playoffs) **Will be updated as the playoffs progress.**\n",
    "* [2018 NBA Playoffs](#2018-NBA-Playoffs) An exciting season.\n",
    "* [2016 NBA Playoffs](#2016-NBA-Playoffs) Ancient history; sad saga.\n",
    "\n",
    "---\n",
    "\n",
    "# Models: Introduction and Discussion\n",
    "\n",
    "\"It's tough to make predictions, especially [about](https://en.wikiquote.org/wiki/Yogi_Berra)  [the](https://en.wikiquote.org/wiki/Niels_Bohr) future.\" That's true for the NBA basketball playoffs, where there is a wide range of opinions.  Here are some models you might choose to help you make predictions:\n",
    "\n",
    "1. **Holistic**: I just feel that my favorite team has about a 1 in 5 chance of winning it all.\n",
    "2. **Game by Game**: I think my team has a 75% chance of winning each game in the first round, then 65% for each game in the second round, but only 45% in the Conference finals, then 55% if they make it to the NBA finals. From that I'll calculate their overall chance.\n",
    "3. **Point by Point**: My team has a per-game average point differential of +5.79; I'll compare that to the other teams and calculate overall chances.\n",
    "4. **Play by Play**: Use [detailed statistics](https://www.basketball-reference.com/play-index/plus/shot_finder.cgi) and overhead video to [model](https://danvatterott.com/blog/2016/06/16/creating-videos-of-nba-action-with-sportsvu-data/) the game shot-by-shot, or even pass-by-pass. Not covered here.\n",
    "\n",
    "# Point by Point Model\n",
    "\n",
    "The **[Simple Rating System](https://www.sportingcharts.com/dictionary/nba/simple-rating-system-statistics.aspx) (SRS)** records the average point differential of a team over the season, with a slight adjustment for strength of schedule (see  [basketball-reference.com](https://www.basketball-reference.com/leagues/NBA_2018.html)) . A great team has an SRS around 10; anything over 5 is very good.\n",
    "\n",
    "The Point-by-Point model says: a game is decided by a random sample from the distribution of point differentials, which is a normal (Gaussian) distribution centered around the difference of SRS scores of the two teams. So, if a team with an SRS of 7 plays an opponent with an SRS of 4, we can expect the team to win by 3, on average, but it will still lose some games. We need to know the standard deviation of the distribution to determine how often that happens; [Betlabs](https://www.betlabssports.com/blog/a-look-at-nba-team-totals/) says the standard deviation \n",
    "is 10.5 points across the NBA. \n",
    "The function `win_game` does the calculation of win probability given an SRS point differential, using Monte Carlo simulation:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "%matplotlib inline\n",
    "import matplotlib.pyplot as plt\n",
    "from statistics import mean\n",
    "from random import gauss\n",
    "from collections import Counter\n",
    "\n",
    "def win_game(srs_diff, 𝝈=10.5, n=100000):\n",
    "    \"Given SRS point differential of a team against another, return game win probability.\"\n",
    "    return mean(gauss(srs_diff, 𝝈) > 0 for game in range(n))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.61201"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "win_game(3)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "So, if  your team has a 3-point edge over an opponent, this model predicts your team will win 61% of the time."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "\n",
    "# Game by Game Model\n",
    "\n",
    "The next model says that a playoff series is a sequence of independent and identically distributed game results (where the probability of a single-game win could be specified using SRS, or holistically, or some other model). The idea here is to be consistent: if you believe that a team's win percentage is 60%, and you believe that games are independent, then you must believe that the team's chance of wining 4 in a row is 0.6<sup>4</sup> = 0.1296. This model ignores the fact that games aren't strictly independent, ignores the possibility of injuries, and ignores home court advantage. Why? Because these factors would change the final winning estimate by only a few percentage points, and I already have more uncertainty than that.\n",
    "\n",
    "The function `win_series` calculates the probability of winning a series, given the probability of winning a game:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "def win_series(p, W=0, L=0):\n",
    "    \"\"\"Probability of winning best-of-7 series, given a probability p of winning a game.\n",
    "    The optional arguments say how many Wins and Losses the team has in the series so far.\"\"\"\n",
    "    return (1 if W == 4 else\n",
    "            0 if L == 4 else\n",
    "            p       * win_series(p, W + 1, L) + \n",
    "            (1 - p) * win_series(p, W, L + 1))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We can make a table:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0 point differential =  50% win game =  50% win series\n",
      "1 point differential =  54% win game =  58% win series\n",
      "2 point differential =  57% win game =  66% win series\n",
      "3 point differential =  61% win game =  73% win series\n",
      "4 point differential =  65% win game =  80% win series\n",
      "5 point differential =  68% win game =  85% win series\n",
      "6 point differential =  72% win game =  89% win series\n",
      "7 point differential =  75% win game =  93% win series\n",
      "8 point differential =  77% win game =  95% win series\n",
      "9 point differential =  80% win game =  97% win series\n"
     ]
    }
   ],
   "source": [
    "for srs_diff in range(10):\n",
    "    g = win_game(srs_diff)\n",
    "    print('{} point differential = {:4.0%} win game = {:4.0%} win series'.format(\n",
    "          srs_diff, g, win_series(g)))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "With a zero point differential obviously you're at 50% win percententage; with a 3 point differential you're at 61% to win a game, and 73% to win the series. This agrees very well with the \"Differential vs. Win Percentage\" [chart](http://a.espncdn.com/combiner/i?img=%2Fphoto%2F2018%2F0408%2F180408_differential.png&w=1140&cquality=40) on [this page](http://www.espn.com/nba/story/_/id/23071005/kevin-pelton-weekly-mailbag-including-nba-all-offensive-teams). \n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "\n",
    "We can also do plots:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "diff   = [d/10 for d in range(101)]\n",
    "game   = [win_game(d) for d in diff]\n",
    "series = [win_series(p) for p in game]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYgAAAEKCAYAAAAIO8L1AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAIABJREFUeJzt3Xd4VGX2wPHvm4T0Qg+h994TugVEsawCNsQGtrWDoruKZde27rLqz7WsiFgQC6CgLooFC0TBUEPvJUAIhBCSkN7n/P64A0YMMIRMbmbmfJ4nz8zcueXcBObMve/7nteICEoppdSJ/OwOQCmlVO2kCUIppVSlNEEopZSqlCYIpZRSldIEoZRSqlKaIJRSSlVKE4RSSqlKaYJQSilVKbclCGPMe8aYw8aYTRWW1TfG/GCM2el8rOdcbowxrxljdhljNhhj+rorLqWUUq4x7hpJbYw5D8gDPhCR7s5lLwCZIjLFGDMZqCcijxpjLgMmAJcBA4BXRWTA6Y7RsGFDad26dZXiy8/PJywsrErbeio9Z9+g5+wbzuacExMTj4hIo9OuKCJu+wFaA5sqvN4OxDifxwDbnc/fAq6vbL1T/cTGxkpVLV68uMrbeio9Z9+g5+wbzuacgdXiwme4264gAIwxrYEF8tsVxFERqet8boAsEalrjFkATBGRpc73fgIeFZHVlezzTuBOgOjo6Ng5c+ZUKba8vDzCw8OrtK2n0nP2DXrOvuFsznnYsGGJIhJ3uvUCqrT3aiAiYow54+wkItOB6QBxcXEydOjQKh0/Pj6eqm7rqfScfYOes2+oiXOu6V5MacaYGADn42Hn8gNAiwrrNXcuU0opZZOavoL4EhgPTHE+zq+w/H5jzBysRupsEUmtygFKS0tJSUmhqKjolOtFRUWxdevWq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mCKWUUpXSBKGUUqpSmiCUUkpV6v8BphLyFy0Y8g0AAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.plot(diff, [100*s for s in series], label='Series Win')\n",
    "plt.plot(diff, [100*g for g in game], label='Game Win')\n",
    "plt.legend(loc='best'); plt.grid()\n",
    "plt.xlabel('Point Differential'); plt.ylabel('Win Percentage');"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYgAAAEKCAYAAAAIO8L1AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAIABJREFUeJzt3Xd8HNW5//HPo2LLttyLcMO9xIB7oyTYtAskFwidhFAuYAJcWuAXSgohITck4dICJEAophpMNYTQjE3HuPeKq9xwlSXZqvv8/pgx6BpJXktajaT9vl+vZXdmZ3aew8j77Jxz5hxzd0RERPaVEnUAIiJSNylBiIhIuZQgRESkXEoQIiJSLiUIEREplxKEiIiUSwlCRETKpQQhIiLlUoIQEZFypUUdQHW0a9fOu3fvXqV98/PzadasWc0GVMepzMlBZU4O1SnzzJkzt7p7+/1tV68TRPfu3ZkxY0aV9p06dSpjxoyp2YDqOJU5OajMyaE6ZTazNfFspyomEREplxKEiIiUSwlCRETKpQQhIiLlUoIQEZFyJSxBmNnjZva1mS0os66Nmb1nZsvD59bhejOz+81shZnNM7OhiYpLRETik8griCeBE/dZdzMw2d37AJPDZYCTgD7hYxzw9wTGJSIicUjYfRDu/pGZdd9n9anAmPD1eGAqcFO4/ikP5j/9wsxamVlHd9+YqPhERKrL3dlTXEpuQQm5BSXsKSpld1EJe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gnFoBhF8gRWU2bfsODuxMssxvv27TgFGu3vZ/crzGXAWwReym9kXBCOEjiT4JV6esse3CrbZ4+6Dy64I213Gu/st5Wxf4O6l+4nVgKvd/Z19PnfMPjGVUs6/bzPrAdxIcGWyw8yeJPjC398xz3D3pfvZThoYtUFIlD4AMszsijLryjamtiT40o4BPyOoEjkQ7wJX713Y21upHJ8RNOTuTQafAxcAm9w95wCPuT+TgTPNrEMYUxsz61bOdkuBjmY2ItyuuQXDWb8DXGHBUO6YWd+wMb0yuQRVZhBUVeUDOeGVz0lljtfTgsmlIBgMb693gKvD5IaZDYm3sFK/KUFIZNzdCaZNPNrMVpnZlwRTKd4UbvIQcGHYaNuf4IvtQFwDDA8bcxdRcS+iT4GehAkirLpKJUgcNcrdFwG/Bt41s3nAewTVPPtuV0TwJf23sPzvEfzS/yfB8NazLJjQ/mH2XxPwCPC2mU1x97kEo50uIWij+TQ83h7gynC7mQRJZW9y/ANBdd88M1sYLksS0GiuIgIEsw+6e154pfAgsNzd74k6LomOriBEZK/LwsbthQTVew9HHI9ETFcQIiJSLl1BiIhIuZQgRESkXEoQIiJSLiUIEREplxKEiIiUSwlCRETK9f8BHu1s5IXqIuMAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "P = range(101)\n",
    "plt.plot(P, [100*win_series(p/100) for p in P])\n",
    "plt.grid()\n",
    "plt.xlabel('Game Win Percentage'); plt.ylabel('Series Win Percentage');"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Series by Series Model\n",
    "\n",
    "The probability of winning a championship can be modeled by assuming that each series is independent, and multiplying the probability of winning each series. The function `playoffs` does this; it takes as arguments a team name and then some playoff round entries, each consisting of the opponent team name, the game win percentage against this opponent, and optionally the wins and losses in the series so far.\n",
    "\n",
    "The function `playoffs` does two calculations, one based on my subjective probability of the team winning a single game (as specified in the entry for each round), and one based on the SRS differential. In each line of the output and for each of these two calculations, we show the probability of winning a single game, the probability of winning the series (given that the two teams are still playing), and the probability of winning all the series up to this point."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "def playoffs(team, *rounds):\n",
    "    \"Print probability for team winning each series (subjective and SRS).\"\n",
    "    all_p = all_srs = 1.0 # Probabilities of winning it all\n",
    "    print('{}    {:8} |      Subjective Probabilities  |     SRS Differential'\n",
    "         .format('Team'.ljust(len(team)), 'Opponent'))\n",
    "    for (opponent, p, *WL) in rounds:\n",
    "        p_srs = win_game(SRS[team] - SRS[opponent])\n",
    "        all_p,   str_p   = update(all_p,   p,     *WL)\n",
    "        all_srs, str_srs = update(all_srs, p_srs, *WL)\n",
    "        print('{} vs {:8} | {} |{}'.format(team, opponent, str_p, str_srs))\n",
    "              \n",
    "def update(all_p, p, W=0, L=0):\n",
    "    \"Update the probability of winning it all, `all_p`, and also return a string.\"\n",
    "    series_p = win_series(p, W, L)\n",
    "    all_p *= series_p\n",
    "    return all_p, '{} Game;{} Series;{} All'.format(pct(p), pct(series_p), pct(all_p))\n",
    "\n",
    "pct = '{:4.0%}'.format "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "---\n",
    "# 2019 NBA Playoffs\n",
    "\n",
    "## 12 April, 2019\n",
    "\n",
    "Here are the SRS scores and my subjective ratings for what I consider the two top teams  in 2019, the Warriors and Bucks, and their likely playoff opponents:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Team        Opponent |      Subjective Probabilities  |     SRS Differential\n",
      "Warriors vs Clippers |  80% Game; 97% Series; 97% All | 69% Game; 87% Series; 87% All\n",
      "Warriors vs Rockets  |  65% Game; 80% Series; 77% All | 56% Game; 62% Series; 54% All\n",
      "Warriors vs Nuggets  |  70% Game; 87% Series; 68% All | 58% Game; 68% Series; 36% All\n",
      "Warriors vs Bucks    |  52% Game; 54% Series; 37% All | 44% Game; 37% Series; 13% All\n"
     ]
    }
   ],
   "source": [
    "SRS = dict(Bucks=8.04,   Warriors=6.42, Raptors=5.49,  Rockets=4.96, Nuggets=4.19,  \n",
    "           Celtics=3.90, Sixers=2.25,   Clippers=1.09, Pistons=-0.56)\n",
    "\n",
    "playoffs('Warriors',\n",
    "         ('Clippers', 0.80),\n",
    "         ('Rockets',  0.65),\n",
    "         ('Nuggets',  0.70),\n",
    "         ('Bucks',    0.52))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Team     Opponent |      Subjective Probabilities  |     SRS Differential\n",
      "Bucks vs Pistons  |  80% Game; 97% Series; 97% All | 79% Game; 96% Series; 96% All\n",
      "Bucks vs Celtics  |  67% Game; 83% Series; 80% All | 65% Game; 81% Series; 78% All\n",
      "Bucks vs Raptors  |  60% Game; 71% Series; 57% All | 60% Game; 70% Series; 54% All\n",
      "Bucks vs Warriors |  48% Game; 46% Series; 26% All | 56% Game; 63% Series; 34% All\n"
     ]
    }
   ],
   "source": [
    "playoffs('Bucks',\n",
    "         ('Pistons',  0.80),\n",
    "         ('Celtics',  0.67),\n",
    "         ('Raptors',  0.60),\n",
    "         ('Warriors', 0.48))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Let's compare championship predictions for four methods: my subjective evaluations, the SRS point differentials, and two methods from [538](https://projects.fivethirtyeight.com/2019-nba-predictions/): ELO, which is similar to SRS, and their more complex CARM-ELO model:\n",
    "\n",
    "\n",
    "|Method|Warriors|Bucks|\n",
    "|------|--------|-----|\n",
    "|Subjective| 37% | 26% |\n",
    "|SRS     | 13% | 35% |\n",
    "| ELO     | 16% | 23% |\n",
    "| CARM-ELO| 61% | 15% |\n",
    "\n",
    "\n",
    "\n",
    "Which prediction method is best? I have low confidence in the SRS ratings, because the Warriors seemed like they were coasting for parts of the regular season and are capable of \"flipping the switch\" in the playoffs, and because the Bucks have significant injuries to Brogdon, Mirotic and Gasol, all of whom contributed to the Bucks' great record in the season but will miss parts of the playoffs.\n",
    "\n",
    "# 1 May, 2019\n",
    "\n",
    "The first round of playoffs was pretty uneventful&mdash;the favored team won in each of the eight matchups. Here's where we are today:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Team        Opponent |      Subjective Probabilities  |     SRS Differential\n",
      "Warriors vs Clippers |  80% Game;100% Series;100% All | 69% Game;100% Series;100% All\n",
      "Warriors vs Rockets  |  65% Game; 95% Series; 95% All | 56% Game; 88% Series; 88% All\n",
      "Warriors vs Nuggets  |  70% Game; 87% Series; 83% All | 59% Game; 68% Series; 60% All\n",
      "Warriors vs Bucks    |  52% Game; 54% Series; 45% All | 44% Game; 37% Series; 22% All\n"
     ]
    }
   ],
   "source": [
    "playoffs('Warriors',\n",
    "         ('Clippers', 0.80, 4, 2),\n",
    "         ('Rockets',  0.65, 2, 0),\n",
    "         ('Nuggets',  0.70),\n",
    "         ('Bucks',    0.52))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Team     Opponent |      Subjective Probabilities  |     SRS Differential\n",
      "Bucks vs Pistons  |  80% Game;100% Series;100% All | 79% Game;100% Series;100% All\n",
      "Bucks vs Celtics  |  67% Game; 80% Series; 80% All | 65% Game; 77% Series; 77% All\n",
      "Bucks vs Raptors  |  60% Game; 71% Series; 56% All | 60% Game; 70% Series; 54% All\n",
      "Bucks vs Warriors |  48% Game; 46% Series; 26% All | 56% Game; 64% Series; 34% All\n"
     ]
    }
   ],
   "source": [
    "playoffs('Bucks',\n",
    "         ('Pistons',  0.80, 4, 0),\n",
    "         ('Celtics',  0.67, 1, 1),\n",
    "         ('Raptors',  0.60),\n",
    "         ('Warriors', 0.48))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 8 May, 2019\n",
    "\n",
    "The favored teams keep winning: three of them are ahead 3-2, and the fourth, the Bucks, won their series 4-1. But the Warriors suffered the loss of a second starter, Keven Durant, to injury, and it is unclear how long he'll be out,\n",
    "so I'm uncertain how to adjust the subjective probabilities:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Team        Opponent |      Subjective Probabilities  |     SRS Differential\n",
      "Warriors vs Clippers |  80% Game;100% Series;100% All | 70% Game;100% Series;100% All\n",
      "Warriors vs Rockets  |  50% Game; 75% Series; 75% All | 56% Game; 80% Series; 80% All\n",
      "Warriors vs Nuggets  |  60% Game; 71% Series; 53% All | 59% Game; 68% Series; 55% All\n",
      "Warriors vs Bucks    |  50% Game; 50% Series; 27% All | 44% Game; 37% Series; 20% All\n"
     ]
    }
   ],
   "source": [
    "playoffs('Warriors',\n",
    "         ('Clippers', 0.80, 4, 2),\n",
    "         ('Rockets',  0.50, 3, 2),\n",
    "         ('Nuggets',  0.60),\n",
    "         ('Bucks',    0.50))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Team     Opponent |      Subjective Probabilities  |     SRS Differential\n",
      "Bucks vs Pistons  |  80% Game;100% Series;100% All | 79% Game;100% Series;100% All\n",
      "Bucks vs Celtics  |  67% Game;100% Series;100% All | 65% Game;100% Series;100% All\n",
      "Bucks vs Raptors  |  60% Game; 71% Series; 71% All | 60% Game; 71% Series; 71% All\n",
      "Bucks vs Warriors |  50% Game; 50% Series; 36% All | 56% Game; 63% Series; 45% All\n"
     ]
    }
   ],
   "source": [
    "playoffs('Bucks',\n",
    "         ('Pistons',  0.80, 4, 0),\n",
    "         ('Celtics',  0.67, 4, 1),\n",
    "         ('Raptors',  0.60),\n",
    "         ('Warriors', 0.50))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "---\n",
    "\n",
    "# 2018 NBA Playoffs\n",
    "\n",
    "## 12 April, 2018\n",
    "\n",
    "The Las Vegas oddsmakers  have the Warriors and Rockers as co-favorites at 35% chance to win the title, while  [538](https://fivethirtyeight.com/features/the-nba-playoffs-sleepers-favorites-and-best-first-round-matchups/), using their CARM-ELO model, favor the Rockets at 44% and give the Warriors only a 4% chance. Those big differences underscore that rational people can use different models with different assumptions and come to different conclusions.  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [],
   "source": [
    "SRS = dict(Raptors=7.29, Celtics=3.23, Sixers=4.30, Cavs=0.59, Rockets=8.21, Warriors=5.79, \n",
    "           Blazers=2.60, Thunder=3.42, Jazz=4.47, Spurs=2.89, Wolves=2.35)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Team       Opponent |      Subjective Probabilities  |     SRS Differential\n",
      "Rockets vs Wolves   |  75% Game; 93% Series; 93% All | 71% Game; 89% Series; 89% All\n",
      "Rockets vs Jazz     |  70% Game; 87% Series; 81% All | 64% Game; 79% Series; 70% All\n",
      "Rockets vs Warriors |  55% Game; 61% Series; 49% All | 59% Game; 69% Series; 49% All\n",
      "Rockets vs Raptors  |  60% Game; 71% Series; 35% All | 54% Game; 58% Series; 28% All\n"
     ]
    }
   ],
   "source": [
    "playoffs('Rockets',\n",
    "         ('Wolves',   0.75),\n",
    "         ('Jazz',     0.70),\n",
    "         ('Warriors', 0.55),\n",
    "         ('Raptors',  0.60))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "So I'm in good agreement with the Vegas oddsmakers about the Rockets: my subjective probabilities have the Rockets at 49% winning the conference and 35% winning the title, while Vegas had them at 44% and 35%. The SRS differential has them at 48% and 27%."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Team        Opponent |      Subjective Probabilities  |     SRS Differential\n",
      "Warriors vs Spurs    |  75% Game; 93% Series; 93% All | 61% Game; 73% Series; 73% All\n",
      "Warriors vs Blazers  |  65% Game; 80% Series; 74% All | 62% Game; 75% Series; 54% All\n",
      "Warriors vs Rockets  |  45% Game; 39% Series; 29% All | 41% Game; 31% Series; 17% All\n",
      "Warriors vs Raptors  |  55% Game; 61% Series; 18% All | 45% Game; 39% Series;  6% All\n"
     ]
    }
   ],
   "source": [
    "playoffs('Warriors',\n",
    "         ('Spurs',   0.75),\n",
    "         ('Blazers', 0.65),\n",
    "         ('Rockets', 0.45),\n",
    "         ('Raptors', 0.55))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "For the Warriors my subjective probabilities are splitting the difference between 538's low estimate (8% win conference, 4% win title) and Vegas's high estimate (44% and 35%, tied with the Rockets); I have them at 29% and 18%. The SRS differential at 17% and 6% is closer to 538.\n",
    "\n",
    "How do I reconcile the discrepancy between my subjective probabilities and the SRS numbers? I guess I would say that I  have  less faith in the point differential model, for several reasons: it counts games from the distant past, when some teams had very different lineups than they have now (due to injuries and trades); different teams have different approaches to how they handle games whose outcome is already decided; the metric puts too much emphasis on blowouts, for example, in the Warriors' final game, it was to their strategic advantage to lose, and they did it very convincingly&mdash;by 40 points, which dropped their average point differential for the entire year by 0.5 points."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "---\n",
    "\n",
    "# 2016 NBA Playoffs\n",
    "\n",
    "\n",
    "## 18 April 2016\n",
    "\n",
    "The Golden State Warriors have had a historic basketball season, winning more games than any other team ever has. But will they top that off by winning the championship? There are 15 other teams in contention, including one, the Spurs, that has had a historic season as the best second-best team ever. The web site fivethirtyeight, using a complicated scoring system, [gives](http://projects.fivethirtyeight.com/2016-nba-picks/) the Warriors a 44% chance of winning, with the Spurs at 28%. Basketball-reference [has](http://www.basketball-reference.com/friv/playoff_prob.cgi) the Warriors at 41% and Spurs at 32.5%, while a [betting site](http://www.oddsshark.com/nba/nba-futures) had the Warriors at 54% and Spurs at 18%. Here is my analysis:\n",
    "  "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Team        Opponent |      Subjective Probabilities  |     SRS Differential\n",
      "Warriors vs Rockets  |  83% Game; 98% Series; 98% All | 83% Game; 98% Series; 98% All\n",
      "Warriors vs Clippers |  73% Game; 91% Series; 89% All | 72% Game; 90% Series; 89% All\n",
      "Warriors vs Spurs    |  58% Game; 67% Series; 60% All | 50% Game; 51% Series; 45% All\n",
      "Warriors vs Cavs     |  67% Game; 83% Series; 50% All | 68% Game; 85% Series; 38% All\n"
     ]
    }
   ],
   "source": [
    "SRS = dict(Warriors=10.38, Spurs=10.28, Thunder=7.09, Cavs=5.45, Raptors=4.08,\n",
    "           Rockets=0.34, Clippers=4.13, Pistons=0.43, Hawks=3.49, Memphis=-2.14,\n",
    "           Blazers=4.43, Dallas=-0.87)\n",
    "\n",
    "playoffs('Warriors',\n",
    "         ('Rockets',  0.83),\n",
    "         ('Clippers', 0.73),\n",
    "         ('Spurs',    0.58),\n",
    "         ('Cavs',     0.67))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Team     Opponent |      Subjective Probabilities  |     SRS Differential\n",
      "Spurs vs Memphis  |  83% Game; 98% Series; 98% All | 88% Game; 99% Series; 99% All\n",
      "Spurs vs Thunder  |  62% Game; 75% Series; 73% All | 62% Game; 74% Series; 74% All\n",
      "Spurs vs Warriors |  42% Game; 33% Series; 24% All | 50% Game; 49% Series; 37% All\n",
      "Spurs vs Cavs     |  67% Game; 83% Series; 20% All | 68% Game; 84% Series; 31% All\n"
     ]
    }
   ],
   "source": [
    "playoffs('Spurs',\n",
    "         ('Memphis',  0.83),\n",
    "         ('Thunder',  0.62),\n",
    "         ('Warriors', 0.42),\n",
    "         ('Cavs',     0.67))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Team    Opponent |      Subjective Probabilities  |     SRS Differential\n",
      "Cavs vs Pistons  |  83% Game; 98% Series; 98% All | 68% Game; 85% Series; 85% All\n",
      "Cavs vs Hawks    |  60% Game; 71% Series; 70% All | 57% Game; 66% Series; 56% All\n",
      "Cavs vs Raptors  |  55% Game; 61% Series; 42% All | 55% Game; 61% Series; 34% All\n",
      "Cavs vs Warriors |  33% Game; 17% Series;  7% All | 32% Game; 16% Series;  5% All\n"
     ]
    }
   ],
   "source": [
    "playoffs('Cavs',\n",
    "         ('Pistons', 0.83),\n",
    "         ('Hawks',   0.60),\n",
    "         ('Raptors', 0.55),\n",
    "         ('Warriors', 0.33))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "I have the Warriors at 50% (for the estimate of winning it all) and the Spurs at 20%, so I'm more of a Warriors fan than fivethirtyeight and basketball-reference. Interestingly, while fivethirtyeight does not think this year's Warriors are better than the 1995 Bulls, they [do think](http://fivethirtyeight.com/features/the-warriors-still-arent-the-best-team-ever/) the Spurs, Thunder, and Cavs are the best ever second-, third-, and fourth-best teams in a season."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# WWWWC: Will Warriors Win Without Curry?\n",
    "\n",
    "## 27 April 2016\n",
    "\n",
    "The Playoff picture has changed! \n",
    "\n",
    "We have some results for first-round series, and there have been key injuries to players including Steph Curry, Avery Bradley, Chris Paul, and Blake Griffin. We don't know for sure how long Curry will be out, but here are my updated odds for the Warriors, under the assumption that Curry misses the second round, and comes back in time for the Western Conference Finals at a mildly reduced capacity:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Team        Opponent |      Subjective Probabilities  |     SRS Differential\n",
      "Warriors vs Rockets  |  70% Game; 97% Series; 97% All | 83% Game;100% Series;100% All\n",
      "Warriors vs Blazers  |  55% Game; 61% Series; 59% All | 71% Game; 89% Series; 89% All\n",
      "Warriors vs Spurs    |  55% Game; 61% Series; 36% All | 50% Game; 51% Series; 45% All\n",
      "Warriors vs Cavs     |  60% Game; 71% Series; 26% All | 68% Game; 85% Series; 38% All\n"
     ]
    }
   ],
   "source": [
    "playoffs('Warriors',\n",
    "         ('Rockets',  0.70, 3, 1),\n",
    "         ('Blazers',  0.55),\n",
    "         ('Spurs',    0.55),\n",
    "         ('Cavs',     0.60))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The Spurs and Cavs are rolling; let's update their odds:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Team     Opponent |      Subjective Probabilities  |     SRS Differential\n",
      "Spurs vs Memphis  |  83% Game;100% Series;100% All | 88% Game;100% Series;100% All\n",
      "Spurs vs Thunder  |  62% Game; 75% Series; 75% All | 62% Game; 74% Series; 74% All\n",
      "Spurs vs Warriors |  45% Game; 39% Series; 29% All | 49% Game; 49% Series; 36% All\n",
      "Spurs vs Cavs     |  67% Game; 83% Series; 24% All | 68% Game; 85% Series; 31% All\n"
     ]
    }
   ],
   "source": [
    "playoffs('Spurs',\n",
    "         ('Memphis',  0.83, 4, 0),\n",
    "         ('Thunder',  0.62),\n",
    "         ('Warriors', 0.45),\n",
    "         ('Cavs',     0.67))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Team    Opponent |      Subjective Probabilities  |     SRS Differential\n",
      "Cavs vs Pistons  |  83% Game;100% Series;100% All | 68% Game;100% Series;100% All\n",
      "Cavs vs Hawks    |  60% Game; 71% Series; 71% All | 57% Game; 65% Series; 65% All\n",
      "Cavs vs Raptors  |  55% Game; 61% Series; 43% All | 55% Game; 61% Series; 40% All\n",
      "Cavs vs Warriors |  40% Game; 29% Series; 13% All | 32% Game; 15% Series;  6% All\n"
     ]
    }
   ],
   "source": [
    "playoffs('Cavs',\n",
    "         ('Pistons',  0.83, 4, 0),\n",
    "         ('Hawks',    0.60),\n",
    "         ('Raptors',  0.55),\n",
    "         ('Warriors', 0.40))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "So my updated odds are that the Warriors and Spurs are roughly equally likely to win (26% and 24%); the Cavs are still less likely (13%), and there is more uncertainty.\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# WWWWCB: Will Warriors Win With Curry Back?\n",
    "\n",
    "## 10 May 2016\n",
    "\n",
    "Curry has returned from his injury, and after a slow shooting start, had the highest-scoring overtime period in the history of the NBA. Meanwhile, the Thunder lead the Spurs, 3-2, and the Cavaliers have been dominant in the East, hitting a historic number of 3-point shots. Here is my revised outlook: "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Team        Opponent |      Subjective Probabilities  |     SRS Differential\n",
      "Warriors vs Rockets  |  70% Game;100% Series;100% All | 83% Game;100% Series;100% All\n",
      "Warriors vs Blazers  |  67% Game; 96% Series; 96% All | 71% Game; 98% Series; 98% All\n",
      "Warriors vs Spurs    |  60% Game; 71% Series; 68% All | 50% Game; 51% Series; 50% All\n",
      "Warriors vs Cavs     |  55% Game; 61% Series; 42% All | 68% Game; 84% Series; 42% All\n"
     ]
    }
   ],
   "source": [
    "playoffs('Warriors',\n",
    "         ('Rockets',  0.70, 4, 1),\n",
    "         ('Blazers',  0.67, 3, 1),\n",
    "         ('Spurs',    0.60),\n",
    "         ('Cavs',     0.55))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Team     Opponent |      Subjective Probabilities  |     SRS Differential\n",
      "Spurs vs Memphis  |  83% Game;100% Series;100% All | 88% Game;100% Series;100% All\n",
      "Spurs vs Thunder  |  60% Game; 36% Series; 36% All | 62% Game; 39% Series; 39% All\n",
      "Spurs vs Warriors |  40% Game; 29% Series; 10% All | 50% Game; 49% Series; 19% All\n",
      "Spurs vs Cavs     |  50% Game; 50% Series;  5% All | 68% Game; 84% Series; 16% All\n"
     ]
    }
   ],
   "source": [
    "playoffs('Spurs',\n",
    "         ('Memphis',  0.83, 4, 0),\n",
    "         ('Thunder',  0.60, 2, 3),\n",
    "         ('Warriors', 0.40),\n",
    "         ('Cavs',     0.50))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Team       Opponent |      Subjective Probabilities  |     SRS Differential\n",
      "Thunder vs Dallas   |  83% Game;100% Series;100% All | 78% Game;100% Series;100% All\n",
      "Thunder vs Spurs    |  40% Game; 64% Series; 64% All | 38% Game; 62% Series; 62% All\n",
      "Thunder vs Warriors |  40% Game; 29% Series; 19% All | 38% Game; 25% Series; 15% All\n",
      "Thunder vs Cavs     |  45% Game; 39% Series;  7% All | 56% Game; 64% Series; 10% All\n"
     ]
    }
   ],
   "source": [
    "playoffs('Thunder',\n",
    "         ('Dallas',   0.83, 4, 1),\n",
    "         ('Spurs',    0.40, 3, 2),\n",
    "         ('Warriors', 0.40),\n",
    "         ('Cavs',     0.45))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Team    Opponent |      Subjective Probabilities  |     SRS Differential\n",
      "Cavs vs Pistons  |  83% Game;100% Series;100% All | 68% Game;100% Series;100% All\n",
      "Cavs vs Hawks    |  60% Game;100% Series;100% All | 58% Game;100% Series;100% All\n",
      "Cavs vs Raptors  |  65% Game; 80% Series; 80% All | 55% Game; 61% Series; 61% All\n",
      "Cavs vs Warriors |  45% Game; 39% Series; 31% All | 32% Game; 15% Series;  9% All\n"
     ]
    }
   ],
   "source": [
    "playoffs('Cavs',\n",
    "         ('Pistons',  0.83, 4, 0),\n",
    "         ('Hawks',    0.60, 4, 0),\n",
    "         ('Raptors',  0.65),\n",
    "         ('Warriors', 0.45))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "So overall, from the start of the playoffs up to May 10th, I have:\n",
    "\n",
    "- **Warriors:** Dropped from 50% to 26% with Curry's injury, and rebounded to 42%. \n",
    "- **Spurs:** Dropped from 20% to 5% after falling behind Thunder.\n",
    "- **Thunder:** Increased to 7%.\n",
    "- **Cavs:** Increased to 31%.\n",
    "\n",
    "# Time to Panic Yet?\n",
    "\n",
    "## 17 May 2016\n",
    "\n",
    "The Thunder finished off the Spurs and beat the Warriors in game 1. Are the Thunder, like the Cavs, peaking at just the right time, after an inconsistant regular season? Is it time for Warriors fans to panic?\n",
    "\n",
    "Sure, the Warriors were down a game twice in last year's playoffs and came back to win both times. Sure, the Warriors are still 3-1 against the Thunder this year, and only lost two games all season to elite teams (Spurs, Thunder, Cavs, Clippers, Raptors). But the Thunder are playing at a top level. Here's my update, showing that the loss cost the Warriors 5%:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Team        Opponent |      Subjective Probabilities  |     SRS Differential\n",
      "Warriors vs Rockets  |  70% Game;100% Series;100% All | 83% Game;100% Series;100% All\n",
      "Warriors vs Blazers  |  67% Game;100% Series;100% All | 72% Game;100% Series;100% All\n",
      "Warriors vs Thunder  |  63% Game; 61% Series; 61% All | 62% Game; 59% Series; 59% All\n",
      "Warriors vs Cavs     |  55% Game; 61% Series; 37% All | 68% Game; 85% Series; 50% All\n"
     ]
    }
   ],
   "source": [
    "playoffs('Warriors',\n",
    "         ('Rockets',  0.70, 4, 1),\n",
    "         ('Blazers',  0.67, 4, 1),\n",
    "         ('Thunder',  0.63, 0, 1),\n",
    "         ('Cavs',     0.55))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Yet!\n",
    "\n",
    "## 24 May 2016\n",
    "\n",
    "The Thunder won two in a row (first time the Warriors had lost two in a row all year), putting the Warriors down 3-1. And the Cavs are looking mortal, losing two to the Raptors. So now it looks to me like the Thunder are favorites to win it all:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Team        Opponent |      Subjective Probabilities  |     SRS Differential\n",
      "Warriors vs Rockets  |  70% Game;100% Series;100% All | 83% Game;100% Series;100% All\n",
      "Warriors vs Blazers  |  67% Game;100% Series;100% All | 71% Game;100% Series;100% All\n",
      "Warriors vs Thunder  |  55% Game; 17% Series; 17% All | 62% Game; 24% Series; 24% All\n",
      "Warriors vs Cavs     |  55% Game; 61% Series; 10% All | 68% Game; 85% Series; 21% All\n"
     ]
    }
   ],
   "source": [
    "playoffs('Warriors',\n",
    "         ('Rockets',  0.70, 4, 1),\n",
    "         ('Blazers',  0.67, 4, 1),\n",
    "         ('Thunder',  0.55, 1, 3),\n",
    "         ('Cavs',     0.55))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Team    Opponent |      Subjective Probabilities  |     SRS Differential\n",
      "Cavs vs Pistons  |  83% Game;100% Series;100% All | 68% Game;100% Series;100% All\n",
      "Cavs vs Hawks    |  60% Game;100% Series;100% All | 58% Game;100% Series;100% All\n",
      "Cavs vs Raptors  |  55% Game; 57% Series; 57% All | 55% Game; 58% Series; 58% All\n",
      "Cavs vs Thunder  |  45% Game; 39% Series; 23% All | 44% Game; 37% Series; 21% All\n"
     ]
    }
   ],
   "source": [
    "playoffs('Cavs',\n",
    "         ('Pistons',  0.83, 4, 0),\n",
    "         ('Hawks',    0.60, 4, 0),\n",
    "         ('Raptors',  0.55, 2, 2),\n",
    "         ('Thunder',  0.45))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Team       Opponent |      Subjective Probabilities  |     SRS Differential\n",
      "Thunder vs Dallas   |  83% Game;100% Series;100% All | 77% Game;100% Series;100% All\n",
      "Thunder vs Spurs    |  40% Game;100% Series;100% All | 38% Game;100% Series;100% All\n",
      "Thunder vs Warriors |  45% Game; 83% Series; 83% All | 37% Game; 75% Series; 75% All\n",
      "Thunder vs Cavs     |  55% Game; 61% Series; 51% All | 56% Game; 63% Series; 48% All\n"
     ]
    }
   ],
   "source": [
    "playoffs('Thunder',\n",
    "         ('Dallas',   0.83, 4, 1),\n",
    "         ('Spurs',    0.40, 4, 2),\n",
    "         ('Warriors', 0.45, 3, 1),\n",
    "         ('Cavs',     0.55))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 1 June 2016: The Finals\n",
    "\n",
    "The Warriors completed their comeback against the Thunder, putting them in a great position to win this year (and they are already established as [favorites for next year](http://www.foxsports.com/nba/story/golden-state-warriors-title-favorites-cleveland-cavaliers-odds-2016-17-053016)). I think the Warriors have about a 55% game win probability (and thus about 61% series probability) against the Cavs. Rather than update this game by game, I'll give a table of series win probability based on game win probability and the number of games won so far. For example, if you agree the Warriors have a 55% game win percentage, and if they win the first game, then check the \"1-0\" row and the \"55%\" column to see that their series win probability has gone up to 74%."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "W-L | Game Win Percentage\n",
      "    |  15%  20%  25%  30%  35%  40%  45%  50%  55%  60%  65%  70%  75%  80%  85%\n",
      "----+---------------------------------------------------------------------------\n",
      "0-3 |   0%   0%   0%   1%   2%   3%   4%   6%   9%  13%  18%  24%  32%  41%  52%\n",
      "0-2 |   0%   1%   2%   3%   5%   9%  13%  19%  26%  34%  43%  53%  63%  74%  84%\n",
      "0-1 |   1%   2%   4%   7%  12%  18%  26%  34%  44%  54%  65%  74%  83%  90%  95%\n",
      "0-0 |   1%   3%   7%  13%  20%  29%  39%  50%  61%  71%  80%  87%  93%  97%  99%\n",
      "----+---------------------------------------------------------------------------\n",
      "1-3 |   0%   1%   2%   3%   4%   6%   9%  12%  17%  22%  27%  34%  42%  51%  61%\n",
      "1-2 |   1%   3%   5%   8%  13%  18%  24%  31%  39%  48%  56%  65%  74%  82%  89%\n",
      "1-1 |   3%   6%  10%  16%  24%  32%  41%  50%  59%  68%  76%  84%  90%  94%  97%\n",
      "1-0 |   5%  10%  17%  26%  35%  46%  56%  66%  74%  82%  88%  93%  96%  98%  99%\n",
      "----+---------------------------------------------------------------------------\n",
      "2-3 |   2%   4%   6%   9%  12%  16%  20%  25%  30%  36%  42%  49%  56%  64%  72%\n",
      "2-2 |   6%  10%  16%  22%  28%  35%  43%  50%  57%  65%  72%  78%  84%  90%  94%\n",
      "2-1 |  11%  18%  26%  35%  44%  52%  61%  69%  76%  82%  87%  92%  95%  97%  99%\n",
      "2-0 |  16%  26%  37%  47%  57%  66%  74%  81%  87%  91%  95%  97%  98%  99% 100%\n",
      "----+---------------------------------------------------------------------------\n",
      "3-3 |  15%  20%  25%  30%  35%  40%  45%  50%  55%  60%  65%  70%  75%  80%  85%\n",
      "3-2 |  28%  36%  44%  51%  58%  64%  70%  75%  80%  84%  88%  91%  94%  96%  98%\n",
      "3-1 |  39%  49%  58%  66%  73%  78%  83%  88%  91%  94%  96%  97%  98%  99% 100%\n",
      "3-0 |  48%  59%  68%  76%  82%  87%  91%  94%  96%  97%  98%  99% 100% 100% 100%\n"
     ]
    }
   ],
   "source": [
    "pcts = [p/100 for p in range(15, 90, 5)]\n",
    "\n",
    "print('W-L | Game Win Percentage')\n",
    "print('    | ' + ' '.join(map(pct, pcts)))\n",
    "for W in range(4):\n",
    "    print('----+' + '-' * 5 * len(pcts))\n",
    "    for L in reversed(range(4)):\n",
    "        results = [win_series(p, W, L) for p in pcts]\n",
    "        print('{}-{} | {}'.format(W, L, ' '.join(map(pct, results))))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 20 June 2016 \n",
    "\n",
    "Congratulations to LeBron, Kyrie, Coach Lue, and all the Cavs for overcoming long odds to win a championship for Cleveland. My model says the Warriors were at 91% win probability when they were up 3-1 (97%  if you go by point differential):"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.9088750000000001"
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "win_series(0.55, W=3, L=1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.966948562677312"
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "win_series(win_game(SRS['Warriors'] - SRS['Cavs']), W=3, L=1)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Additional Calculations: Series Length\n",
    "\n",
    "Given a team's game win percentage, how many games should we expect a series to run? For example, for a team with a game win percentage of 55%, how likely is it to sweep all 4 games? To go to 7 games? Here's a chart of the probability of each possible series outcome, based on the win percentage of the first team:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "W-L | Game Win Percentage\n",
      "    |  15%  20%  25%  30%  35%  40%  45%  50%  55%  60%  65%  70%  75%  80%  85%\n",
      "----+---------------------------------------------------------------------------\n",
      "4-0 |   0%   0%   0%   1%   2%   3%   4%   6%   9%  13%  18%  24%  32%  41%  52%\n",
      "4-1 |   0%   1%   1%   2%   4%   6%   9%  12%  16%  21%  25%  29%  32%  33%  31%\n",
      "4-2 |   0%   1%   2%   4%   6%   9%  12%  16%  19%  21%  22%  22%  20%  16%  12%\n",
      "4-3 |   1%   2%   3%   6%   8%  11%  14%  16%  17%  17%  15%  13%  10%   7%   4%\n",
      "3-4 |   4%   7%  10%  13%  15%  17%  17%  16%  14%  11%   8%   6%   3%   2%   1%\n",
      "2-4 |  12%  16%  20%  22%  22%  21%  19%  16%  12%   9%   6%   4%   2%   1%   0%\n",
      "1-4 |  31%  33%  32%  29%  25%  21%  16%  12%   9%   6%   4%   2%   1%   1%   0%\n",
      "0-4 |  52%  41%  32%  24%  18%  13%   9%   6%   4%   3%   2%   1%   0%   0%   0%\n"
     ]
    }
   ],
   "source": [
    "def series_results(p, weight=1, W=0, L=0) -> Counter:\n",
    "    \"\"\"Return {(win, loss): probability} for all possible outcomes of the series.\"\"\"\n",
    "    if W == 4 or L == 4:\n",
    "        return Counter({(W, L): weight})\n",
    "    else:\n",
    "        return (series_results(p, weight * p,       W + 1, L)\n",
    "              + series_results(p, weight * (1 - p), W,     L+1))\n",
    "            \n",
    "def series_results_table(pcts=pcts):\n",
    "    outcomes = [(4, 0), (4, 1), (4, 2), (4, 3), (3, 4), (2, 4), (1, 4), (0, 4)]\n",
    "    print('W-L | Game Win Percentage')\n",
    "    print('    | ' + ' '.join(map(pct, pcts)))\n",
    "    print('----+'  + '-' * 5 * len(pcts))\n",
    "    for (W, L) in outcomes:\n",
    "        results = [series_results(p)[W, L] for p in pcts]\n",
    "        print('{}-{} | {}'.format(W, L, ' '.join(map(pct, results))))\n",
    "\n",
    "series_results_table()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Our hypothetical 55% team has a 9% chance of sweeping, and a 17+14 = 31% chance of going to 7 games."
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
